import type { FormRule, PrimaryTableCol } from 'tdesign-vue-next';

import { t } from '@/locales';

/**
 * 搜索表单项
 */
export const searchParams: SearchParamsProps[] = [
    {
        label: t('pages.food.title'),
        key: 'title',
    },
    {
        label: t('pages.food.typeId'),
        key: 'typeId',
        valueType: 'select',
    },
];

/**
 * 表格列
 */
export const columns: PrimaryTableCol[] = [
    {
        title: t('pages.food.title'),
        ellipsis: true,
        align: 'center',
        colKey: 'title',
    },
    {
        title: t('pages.food.typeId'),
        ellipsis: true,
        align: 'center',
        colKey: 'typeId',
    },
    {
        title: t('pages.food.imageUrls'),
        ellipsis: true,
        align: 'center',
        colKey: 'imageUrls',
    },
    {
        title: t('pages.food.nutrient'),
        ellipsis: true,
        align: 'center',
        colKey: 'nutrient',
    },
    {
        title: t('pages.food.heat'),
        ellipsis: true,
        align: 'center',
        colKey: 'heat',
    },
    {
        title: t('pages.food.protein'),
        ellipsis: true,
        align: 'center',
        colKey: 'protein',
    },
    {
        title: t('pages.food.fat'),
        ellipsis: true,
        align: 'center',
        colKey: 'fat',
    },
    {
        title: t('pages.food.carbonWater'),
        ellipsis: true,
        align: 'center',
        colKey: 'carbonWater',
    },
    {
        title: t('pages.food.dietaryFiber'),
        ellipsis: true,
        align: 'center',
        colKey: 'dietaryFiber',
    },
    {
        title: t('pages.food.vitaminA'),
        ellipsis: true,
        align: 'center',
        colKey: 'vitaminA',
    },
    {
        title: t('pages.food.vitaminC'),
        ellipsis: true,
        align: 'center',
        colKey: 'vitaminC',
    },
    {
        title: t('pages.food.vitaminE'),
        ellipsis: true,
        align: 'center',
        colKey: 'vitaminE',
    },
    {
        title: t('pages.food.carrot'),
        ellipsis: true,
        align: 'center',
        colKey: 'carrot',
    },
    {
        title: t('pages.food.vitaminB1'),
        ellipsis: true,
        align: 'center',
        colKey: 'vitaminB1',
    },
    {
        title: t('pages.food.vitaminB2'),
        ellipsis: true,
        align: 'center',
        colKey: 'vitaminB2',
    },
    {
        title: t('pages.food.niacin'),
        ellipsis: true,
        align: 'center',
        colKey: 'niacin',
    },
    {
        title: t('pages.food.cholesterol'),
        ellipsis: true,
        align: 'center',
        colKey: 'cholesterol',
    },
    {
        title: t('pages.food.magnesium'),
        ellipsis: true,
        align: 'center',
        colKey: 'magnesium',
    },
    {
        title: t('pages.food.iron'),
        ellipsis: true,
        align: 'center',
        colKey: 'iron',
    },
    {
        title: t('pages.food.calcium'),
        ellipsis: true,
        align: 'center',
        colKey: 'calcium',
    },
    {
        title: t('pages.food.zinc'),
        ellipsis: true,
        align: 'center',
        colKey: 'zinc',
    },
    {
        title: t('pages.food.copper'),
        ellipsis: true,
        align: 'center',
        colKey: 'copper',
    },
    {
        title: t('pages.food.manganese'),
        ellipsis: true,
        align: 'center',
        colKey: 'manganese',
    },
    {
        title: t('pages.food.potassium'),
        ellipsis: true,
        align: 'center',
        colKey: 'potassium',
    },
    {
        title: t('pages.food.phosphorus'),
        ellipsis: true,
        align: 'center',
        colKey: 'phosphorus',
    },
    {
        title: t('pages.food.sodium'),
        ellipsis: true,
        align: 'center',
        colKey: 'sodium',
    },
    {
        title: t('pages.food.selenium'),
        ellipsis: true,
        align: 'center',
        colKey: 'selenium',
    },
    {
        title: t('pages.food.remarks'),
        ellipsis: true,
        align: 'center',
        colKey: 'remarks',
    },
];

/**
 * 表单校验规则
 */
export const rules: Record<string, FormRule[]> = {
    title: [{ required: true, message: t('pages.food.required.title'), type: 'error', trigger: 'blur' }],
    typeId: [{ required: true, message: t('pages.food.required.typeId'), type: 'error', trigger: 'blur' }],
};
